//package com.asset.crm.domain;
//
//import java.io.ByteArrayInputStream;
//import java.io.InputStream;
//import java.text.DateFormat;
//import java.util.ArrayList;
//import java.util.Date;
//import java.util.Iterator;
//import java.util.List;
//import java.util.Map;
//import java.util.Set;
//
//
//import org.apache.poi.hssf.usermodel.HSSFWorkbook;
//import org.apache.poi.poifs.filesystem.POIFSFileSystem;
//import org.apache.poi.ss.usermodel.Cell;
//import org.apache.poi.ss.usermodel.DateUtil;
//import org.apache.poi.ss.usermodel.Row;
//import org.apache.poi.ss.usermodel.Sheet;
//import org.apache.poi.ss.util.CellReference;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.stereotype.Service;
//import org.springframework.transaction.annotation.Transactional;
//
//
//import com.asset.salesforce.enums.VIEWTYPE;
//import com.asset.salesforce.service.AppointmentService;
//import com.asset.salesforce.service.CallService;
//import com.asset.salesforce.service.CityService;
//import com.asset.salesforce.service.ContactService;
//import com.asset.salesforce.service.CountryService;
//import com.asset.salesforce.service.DateValidationUtil;
//import com.asset.salesforce.service.ImportLeadUtils;
//import com.asset.salesforce.service.EmployeeService;
//import com.asset.salesforce.service.LeadService;
//
//@Service
//@Transactional(noRollbackFor=RuntimeException.class,readOnly=true)
//public class ExcelLead {
//	@Value("${lead.leadStatus}")
//	private String leadStatus;
//	
//	@Value("${lead.leadOwner}")
//    private String leadOwner;
//	
//	@Value("${lead.category}")
//    private String category;
//	
//	@Value("${lead.companyName}")
//    private String companyName;
//	
//	@Value("${lead.phone}")
//    private String phone;
//	
//	@Value("${lead.street}")
//    private String street;
//	
//	@Value("${lead.email}")
//    private String email;
//	
//	@Value("${lead.carsNum}")
//    private String carsNum;
//	
//	@Value("${lead.leadSource}")
//    private String leadSource;
//	
//	@Value("${lead.description}")
//    private String description;
//	
//	@Value("${lead.rating}")
//    private String rating;
//	
//	@Value("${lead.addToCarsNums}")
//    private String addToCarsNums;
//	
//	@Value("${lead.againAddToCarsNums}")
//    private String againAddToCarsNums;
//	
//	@Value("${call.date}")
//	private String callDate;
//	
//	@Value("${call.comments}")
//	private String callComments;
//	
//	@Value("${call.decisionMaker}")
//	private String decisionMaker;
//	
//	@Value("${contact.name}")
//	private String contactName;
//	
//	@Value("${contact.title}")
//	private String contactTitle;
//	
//	@Value("${contact.phone}")
//	private String contactPhone;
//	
//	@Value("${contact.newName}")
//	private String contactNewName;
//	
//	@Value("${contact.newtitle}")
//	private String contactNewtitle;
//	
//	@Value("${appointment.day}")
//	private String appointmentDay;
//	
//	@Value("${appoimtment.date}")
//	private String appoimtmentDate;
//	
//	@Value("${appointment.time}")
//	private String appointmentTime;
//	
//	@Value("${appointment.comfirmationDateExpected}")
//	private String appointmentComfirmationDateExpected;
//	
//	@Value("${appointment.salesMan}")
//	private String appointmentSalesMan;
//	
//	@Value("${appointment.meetingDone}")
//	private String appointmentMeetingDone;
//	
//	@Value("${appointment.meetingDuration}")
//	private String appointmentMeetingDuration;
//	
//	@Value("${appointment.demoDone}")
//	private String appointmentDemoDone;
//	
//	@Value("${appointment.offerSubmitted}")
//	private String appointmentOfferSubmitted;
//	
//	@Value("${appointment.discountDone}")
//	private String appointmentDiscountDone;
//	
//	@Value("${appointment.compittorOffer}")
//	private String appointmentCompittorOffer;
//	
//	@Value("${appointment.replayPeriod}")
//	private String appointmentReplayPeriod;
//	
//	@Value("${appointment.comments}")
//	private String appointmentComments;
//	
//	@Value("${appointment.dealDone}")
//	private String appointmentDealDone;
//	
//	@Value("${appointment.dealReason}")
//	private String appointmentDealReason;
//	
//	@Value("${appointment.nextFollowUpCallDate}")
//	private String appointmentNextFollowUpCallDate;
//	
//	@Value("${appointment.nextFollowUpCallDetails}")
//	private String appointmentNextFollowUpCallDetails;
//	
//	@Autowired
//	private LeadService leadService;
//	
//	@Autowired
//	private EmployeeService employeeService;
//	
//	@Autowired
//	private CountryService countryService;
//	
//	@Autowired
//	private CityService cityService;
////	
////	@Autowired
////	private IndusteryService industeryService;
////	
////	@Autowired
////	private LeadSourceService leadSourceService;
////	
////	@Autowired
////	private LeadStatusService leadStatusService;
////	
////	@Autowired
////	private RatingService ratingService;
////	
//	@Autowired
//	private ImportLeadUtils importLeadUtils;
//	
//	@Autowired
//	private CallService callService;
//	
//	@Autowired
//	private AppointmentService appointmentService;
//	
//	@Autowired
//	private ContactService contactService;
//	
////	@Autowired 
////	private ViewTypeService viewTypeService;
//
//	/**
//	 * @return the leadOwner
//	 */
////	public String getLeadOwner() {
////		return leadOwner;
////	}
////	/**
////	 * @param leadOwner the leadOwner to set
////	 */
////	public void setLeadOwner(String leadOwner) {
////		this.leadOwner = leadOwner;
////	}
//	/**
//	 * @return the date
//	 */
//	
//	
//	@Transactional(noRollbackFor=RuntimeException.class,readOnly=false)
//	public void  addLeadsAsset(byte []bs,Integer start,Employee userDetails) {
//
//		try{
//			InputStream inp = new ByteArrayInputStream(bs);
//			HSSFWorkbook workbook = new HSSFWorkbook(new POIFSFileSystem(inp));
//			Sheet  sheet = workbook.getSheetAt(0);
////			List<Row> rows = new ArrayList<Row>();
//			for (Row row : sheet) {
//				if(row.getRowNum()>=(start-1)){
////					rows.add(row);
//					  Lead lead = new Lead();
//					  Call call = new Call();
//					  Account account = new Account();
//					  Appointment appointment = new Appointment();
//					  Contact contact  = new Contact();
//					  Contact  newContact = new Contact();
////						List<Cell> cells = new ArrayList<Cell>();
//						Integer checkNullsRowsFlag=new Integer(0);
////						System.out.println(">>>>>>>>>>>>>>>iiiiiiiiiiiiiiiiiiiiii>>>><<<<<<<<<<<<<<");
//							for (Cell cell : row) {
////								cells.add(cell);
//
//								CellReference cellReference = new CellReference(row.getRowNum(), cell.getColumnIndex());
//								@SuppressWarnings("static-access")
//								String columnName =  cellReference.convertNumToColString(cell.getColumnIndex());
//								if(leadOwner.equalsIgnoreCase(columnName)){
////									Employee employee = employeesService.getEmployeeByEmail(cell.toString());
////									if(employee != null){
//										lead.setLeadOwner(userDetails);
////										checkNullsRowsFlag++;
////									}
//									continue;
//								}
//								else if(appointmentCompittorOffer.equalsIgnoreCase(columnName)){
//									if(cell.toString() != null && !cell.toString().equalsIgnoreCase("")){
//										appointment.setCompatitorOffer(importLeadUtils.checkCompititorOffer(cell.toString()));
//										checkNullsRowsFlag++;
//									}
//									continue;
//								}
//								else if(category.equalsIgnoreCase(columnName)){
//									if(cell.toString() != null && !cell.toString().equalsIgnoreCase("")){
//										lead.setCategory(cell.toString());
//										checkNullsRowsFlag++;
//									}
//									continue;
//								}
//								else if(callDate.equalsIgnoreCase(columnName)){
//									if(cell.toString() != null && !cell.toString().equalsIgnoreCase("")){
//										switch (cell.getCellType()) {
//										 case Cell.CELL_TYPE_NUMERIC:
//											 if (DateUtil.isCellDateFormatted(cell)) {
//												 lead.setDate(cell.getDateCellValue());
//												 call.setDate(cell.getDateCellValue());
//												 checkNullsRowsFlag++;
//						                    }
//											 break;
//											case Cell.CELL_TYPE_STRING:
//												if(importLeadUtils.checkDateInFormDayMonthYear(cell.toString())){
//													Date date = importLeadUtils.dateInFormDayMonthYear(cell.toString());
//													call.setDate(date);
//													lead.setDate(date);
//													checkNullsRowsFlag++;
//												}
//												else if(importLeadUtils.checkDateInFormDayMonthYearDashes(cell.toString())){
//													Date date = importLeadUtils.dateInFormDayMonthYearDashes(cell.toString());
//													call.setDate(date);
//													lead.setDate(date);
//													checkNullsRowsFlag++;
//												}
//												else if(importLeadUtils.checkDateInFormMonthDayYearDashes(cell.toString())){
//													Date date = importLeadUtils.dateInFormMonthDayYearDashes(cell.toString());
//													call.setDate(date);
//													lead.setDate(date);
//													checkNullsRowsFlag++;
//												}
//												else if(importLeadUtils.checkDateInFormMonthDayYear(cell.toString())){
//													Date date = importLeadUtils.dateInFormMonthDayYear(cell.toString());
//													call.setDate(date);
//													lead.setDate(date);
//													checkNullsRowsFlag++;
//												}
//												break;
//										}
//									}
//									continue;
//								}
//								else if(appointmentDiscountDone.equalsIgnoreCase(columnName)){
//
//									if(cell.toString() != null && !cell.toString().equalsIgnoreCase("")){
//										appointment.setDiscountDone(importLeadUtils.checkCompititorOffer(cell.toString()));
//										checkNullsRowsFlag++;
//									}else if(cell.toString() != null){
//										appointment.setDiscountDone(importLeadUtils.checkCompititorOffer(cell.toString()));
//									}
//									continue;
//								}
//								else if(appointmentOfferSubmitted.equalsIgnoreCase(columnName)){
//									if(cell.toString() != null && !cell.toString().equalsIgnoreCase("")){
//										appointment.setOfferSubmitted(importLeadUtils.checkCompititorOffer(cell.toString()));
//										checkNullsRowsFlag++;
//									}
//									continue;
//								}
//								else if(appointmentReplayPeriod.equalsIgnoreCase(columnName)){
//
//									if(cell.toString() != null && !cell.toString().equalsIgnoreCase("")){
//										appointment.setReplyPeriod(cell.toString());
//										checkNullsRowsFlag++;
//									}
//									continue;
//								}
//								else if(appointmentComments.equalsIgnoreCase(columnName)){
//
//									if(cell.toString() != null && !cell.toString().equalsIgnoreCase("")){
//										appointment.setComment(cell.toString());
//										checkNullsRowsFlag++;
//									}
//									continue;
//								}
//								else if(appointmentDealDone.equalsIgnoreCase(columnName)){
//
//									if(cell.toString() != null && !cell.toString().equalsIgnoreCase("")){
//										appointment.setDealClosingDone(importLeadUtils.checkCompititorOffer(cell.toString()));
//										checkNullsRowsFlag++;
//									}else if(cell.toString() != null){
//										appointment.setDealClosingDone(importLeadUtils.checkCompititorOffer(cell.toString()));
//									}
//									continue;
//								}
//
//								else if(appointmentDealReason.equalsIgnoreCase(columnName)){
//									
//
//									if(cell.toString() != null && !cell.toString().equalsIgnoreCase("")){
//										appointment.setDealClosingReason(cell.toString());
//										checkNullsRowsFlag++;
//									}
//									continue;
//								}
//								else if(appointmentNextFollowUpCallDate.equalsIgnoreCase(columnName)){
//
//									if(cell.toString() != null && !cell.toString().equalsIgnoreCase("")){
//										//appointment.setNextFollowUp(true);
//										//appointment.setFollowUpDate(followUpDate);
//										if(importLeadUtils.checkDateInFormDayMonthYear(cell.toString())){
//											Date date = importLeadUtils.dateInFormDayMonthYear(cell.toString());
//											call.setDate(date);
//											checkNullsRowsFlag++;
//										}
//										else if(importLeadUtils.checkDateInFormDayMonthYearDashes(cell.toString())){
//											Date date = importLeadUtils.dateInFormDayMonthYearDashes(cell.toString());
//											call.setDate(date);
//											checkNullsRowsFlag++;
//										}
//										
//										checkNullsRowsFlag++;
//									}
//									continue;
//								}
//
//								else if(appointmentNextFollowUpCallDetails.equalsIgnoreCase(columnName)){
//
//									if(cell.toString() != null && !cell.toString().equalsIgnoreCase("")){
//										appointment.setFollowUpDetails(cell.toString());
//										checkNullsRowsFlag++;
//									}
//									continue;
//								}
//								else if(appointmentDemoDone.equalsIgnoreCase(columnName)){
//									if(cell.toString() != null && !cell.toString().equalsIgnoreCase("")){
//										appointment.setDemoDone(importLeadUtils.checkCompititorOffer(cell.toString()));
//										checkNullsRowsFlag++;
//									}else if(cell.toString() != null){
//										appointment.setDemoDone(importLeadUtils.checkCompititorOffer(cell.toString()));
//									}
//									continue;
//								}
//								else if(appointmentMeetingDuration.equalsIgnoreCase(columnName)){
//
//									if(cell.toString() != null && !cell.toString().equalsIgnoreCase("")){
//										appointment.setMeetingDuration(cell.toString());
//										checkNullsRowsFlag++;
//									}else if(cell.toString() != null){
//										appointment.setMeetingDuration(cell.toString());
//									}
//									continue;
//								}
//								else if(appointmentMeetingDone.equalsIgnoreCase(columnName)){
//
//									if(cell.toString() != null && !cell.toString().equalsIgnoreCase("")){
//										appointment.setMeetingDone(importLeadUtils.checkCompititorOffer(cell.toString()));
//										checkNullsRowsFlag++;
//									}
//									continue;
//								}
//								else if(appointmentSalesMan.equalsIgnoreCase(columnName)){
//
//									if(cell.toString() != null && !cell.toString().equalsIgnoreCase("")){
//										Employee employee = employeeService.getEmployeeByEmail(cell.toString());
//										if(employee != null){
//											appointment.setSalesMan(employee);
//											checkNullsRowsFlag++;
//										}
//										
//									}
//									continue;
//								}
//								else if(appointmentComfirmationDateExpected.equalsIgnoreCase(columnName)){
//
//									if(cell.toString() != null && !cell.toString().equalsIgnoreCase("")){
//										appointment.setConfirmationDateExpected(cell.toString());
//										checkNullsRowsFlag++;
//									}
//									continue;
//								}
//								else if(appointmentTime.equalsIgnoreCase(columnName)){
//
//									if(cell.toString() != null && !cell.toString().equalsIgnoreCase("")){
//										appointment.setTime(cell.toString());
//										checkNullsRowsFlag++;
//									}
//									continue;
//								}
//								
//								else if(appoimtmentDate.equalsIgnoreCase(columnName)){
//									
//									if(cell.toString() != null && !cell.toString().equalsIgnoreCase("")){
//										System.out.println(appoimtmentDate+" @@@@@@@@@@@@@@@@@@@@@@@Big iffffffff"+cell.toString());
//										if(importLeadUtils.checkDateInFormDayMonthYear(cell.toString())){
//											Date date = importLeadUtils.dateInFormDayMonthYear(cell.toString());
//											System.out.println(appoimtmentDate+" @@@@@@@@@@@@@@@@@@@@@@@ iffffffff"+cell.toString());
//											appointment.setDate(date);
//											checkNullsRowsFlag++;
//										}
//										else if(importLeadUtils.checkDateInFormDayMonthYearDashes(cell.toString())){
//											System.out.println(appoimtmentDate+" @@@@@@@@@@@@@@@@@@@@@@@ else if"+cell.toString());
//											Date date = importLeadUtils.dateInFormDayMonthYearDashes(cell.toString());
//											appointment.setDate(date);
//											checkNullsRowsFlag++;
//										}
//										else if(cell.getCellType()== Cell.CELL_TYPE_NUMERIC){
//											System.out.println(appoimtmentDate+" @@@@@@@@@@@@@@@@@@@@@@@ else if22"+cell.toString());
//											if(DateUtil.isCellDateFormatted(cell)){
//												System.out.println(appoimtmentDate+" @@@@@@@@@@@@@@@@@@@@@@@ else if22if"+cell.toString());
//												appointment.setDate(cell.getDateCellValue());
//											}
//										}
//									}
//									continue;
//								}
//								else if(appointmentDay.equalsIgnoreCase(columnName)){
//
//									if(cell.toString() != null && !cell.toString().equalsIgnoreCase("")){
//										appointment.setDay(cell.toString());
//										checkNullsRowsFlag++;
//									}
//									continue;
//								}
//								else if(contactNewtitle.equalsIgnoreCase(columnName)){
//
//									if(cell.toString() != null && !cell.toString().equalsIgnoreCase("")){
//										newContact.setTitle(cell.toString());
//										checkNullsRowsFlag++;
//									}
//									continue;
//								}
//								else if(contactNewName.equalsIgnoreCase(columnName)){
//
//									if(cell.toString() != null && !cell.toString().equalsIgnoreCase("")){
//										newContact.setfName(cell.toString());
//										checkNullsRowsFlag++;
//									}
//									continue;
//								}
//								
//								else if(contactPhone.equalsIgnoreCase(columnName)){
//
//									if(cell.toString() != null && !cell.toString().equalsIgnoreCase("")){
//										switch (cell.getCellType()) {
//										case Cell.CELL_TYPE_NUMERIC:
//											System.out.println("l;sjabfgakvbsfsaiggfyvhmsafhkahsvf"+cell.getNumericCellValue());
//											contact.setPhone(new Double(cell.getNumericCellValue()).toString());
//											break;
//
//										default:
//											contact.setPhone(cell.toString());
//											break;
//										}
//										
//										checkNullsRowsFlag++;
//									}
//									continue;
//								}
//								else if(contactTitle.equalsIgnoreCase(columnName)){
//
//									if(cell.toString() != null && !cell.toString().equalsIgnoreCase("")){
//										contact.setTitle(cell.toString());
//										checkNullsRowsFlag++;
//										}
//									continue;
//								}
//								
//								else if(decisionMaker.equalsIgnoreCase(columnName)){
//
//									if(cell.toString() != null && !cell.toString().equalsIgnoreCase("")){
//										
//										call.setDecisionMaker(importLeadUtils.checkCompititorOffer(cell.toString()));
//										checkNullsRowsFlag++;
//									}else if(cell.toString() != null ){
//										call.setDecisionMaker(importLeadUtils.checkCompititorOffer(cell.toString()));
//									}
//									continue;
//								}
//								else if(contactName.equalsIgnoreCase(columnName)){
//
//									if(cell.toString() != null && !cell.toString().equalsIgnoreCase("")){
//										String[] str = importLeadUtils.splitNameFromSheet(cell.toString());
//										contact.setfName(str[0]);
//										contact.setlName(str[1]);
//										lead.setfName(str[0]);
//										lead.setlName(str[1]);
//										checkNullsRowsFlag++;
//									}
//									continue;
//								}
//								else if(callComments.equalsIgnoreCase(columnName)){
//
//									if(cell.toString() != null && !cell.toString().equalsIgnoreCase("")){
//										call.setComment(cell.toString());
//										lead.setDescription(cell.toString());
//										checkNullsRowsFlag++;
//									}
//									continue;
//								}
//								else if(againAddToCarsNums.equalsIgnoreCase(columnName)){
//
//									if(cell.toString() != null && !cell.toString().equalsIgnoreCase("")){
//										lead.setCarsNum(cell.toString());
//									}
//									continue;
//								}
//								else if(addToCarsNums.equalsIgnoreCase(columnName)){
//
//									if(cell.toString() != null && !cell.toString().equalsIgnoreCase("")){
//									//	lead.setCarsNum(Integer.parseInt(cells.get(j).toString()));
//									}
//									continue;
//								}
//								else if(rating.equalsIgnoreCase(columnName)){
//
//									if(cell.toString() != null && !cell.toString().equalsIgnoreCase("")){
//										lead.setRating(cell.toString());
//									}
//									continue;
//								}
//								else if(description.equalsIgnoreCase(columnName)){
//
//									if(cell.toString() != null && !cell.toString().equalsIgnoreCase("")){
//										lead.setDescription(cell.toString());
//									}
//									continue;
//								}
//								else if(leadSource.equalsIgnoreCase(columnName)){
//
//									if(cell.toString() != null && !cell.toString().equalsIgnoreCase("")){
//										lead.setLeadSource(cell.toString());
//									}
//									continue;
//								}
//								else if(carsNum.equalsIgnoreCase(columnName)){
//
//									if(cell.toString() != null && !cell.toString().equalsIgnoreCase("")){
//										if(lead.getCarsNum() == null){
//											lead.setCarsNum(cell.toString());
//										}
//									}
//									continue;
//								}
//								else if(email.equalsIgnoreCase(columnName)){
//
//									if(cell.toString() != null && !cell.toString().equalsIgnoreCase("")){
//										lead.setEmail(cell.toString());
//										checkNullsRowsFlag++;
//									}
//									continue;
//								}
//								else if(street.equalsIgnoreCase(columnName)){
//
//									if(cell.toString() != null && !cell.toString().equalsIgnoreCase("")){
//										lead.setStreet(cell.toString());
//										checkNullsRowsFlag++;
//									}
//									continue;
//								}
//								else if(phone.equalsIgnoreCase(columnName)){
//
//									if(cell.toString() != null && !cell.toString().equalsIgnoreCase("")){
//										lead.setPhone(cell.toString());
//										checkNullsRowsFlag++;
//									}
//									continue;
//								}
//								else if(companyName.equalsIgnoreCase(columnName)){
//
//									if(cell.toString() != null && !cell.toString().equalsIgnoreCase("")){
//										lead.setCompanyName(cell.toString());
//										checkNullsRowsFlag++;
//									}
//									continue;
//								}
//								else if(leadStatus.equalsIgnoreCase(columnName)){
//
//									if(cell.toString() != null && !cell.toString().equalsIgnoreCase("")){
//										lead.setLeadStatus(cell.toString());
//										checkNullsRowsFlag++;
//									}
//									continue;
//								}
////					System.out.println("========================================================="+columnName);
//							
//								
//							}
//						
//						
//						//for(int j = 0; j<cells.size();j++){}
//						if(checkNullsRowsFlag >0){
//							lead.setIsDeleted(false);
//							lead.setIsConverted(false);
//							Date date = new Date();
//							lead.setDateCreated(date);
//							lead.setDateModified(date);
//							leadService.addLead(lead);
//							contact.setParentId(lead.getId());
////							ViewType viewType = viewTypeService.getViewTypeById(1);
//							contact.setViewType(VIEWTYPE.Lead.getName());
//							contact.setIsDeleted(false);
//							contact.setCreator(userDetails);
//							contact.setDateCreated(date);
//							contact.setDateModified(date);
//							contact.setParentName(lead.getfName());
//							contactService.addContact(contact);
//							newContact.setParentId(lead.getId());
//							newContact.setViewType(VIEWTYPE.Lead.getName());
//							newContact.setIsDeleted(false);
//							newContact.setCreator(userDetails);
//							newContact.setDateCreated(new Date());
//							newContact.setDateModified(date);
//							newContact.setParentName(lead.getfName());
//							contactService.addContact(newContact);
//							call.setParentId(lead.getId());
//							call.setParentType("lead");
//							call.setCrmStaff(userDetails);
//							call.setContactedPerson(contact);
//							call.setDateCreated(date);
//							call.setDateModified(date);
//							java.util.Calendar calInst = java.util.Calendar.getInstance();
//							calInst.setTime(date);
////							System.out.println(">>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<"+calInst.getTime().getHours());
//							call.setStartTime(new Integer(calInst.getTime().getHours()).toString()+":"+new Integer(calInst.getTime().getMinutes()+row.getRowNum()).toString());
//							call.setEndTime(new Integer(calInst.getTime().getHours()).toString()+":"+new Integer(calInst.getTime().getMinutes()+row.getRowNum()+10).toString());
//							call.setInOutCall(false);
//							call.setNextFollowUp(true);
//							call.setDecisionMaker(true);
//							callService.addCall(call);
//							appointment.setParentId(lead.getId());
//							appointment.setParentType("lead");
//							appointment.setSalesMan(userDetails);
//							appointment.setContactedPerson(newContact);
//							appointment.setNextFollowUp(true);
//							appointment.setCompatitorOffer(true);
//							appointment.setOfferSubmitted(true);
//							appointment.setMeetingDone(true);
//							appointment.setDiscountDone(true);
//							appointment.setDemoDone(true);
//							appointment.setDealClosingDone(true);
//							appointment.setDealClosingDone(true);
//							appointment.setDateCreated(date);
//							appointment.setDateModified(date);
//							appointmentService.addAppointment(appointment);
//						}
//				}
//			}
////				System.out.println(">>>>>>>>>>>>>>>rows size>>>><<<<<<<<<<<<<<");
////		  for (int i = 0;i<rows.size();i++) {
////
////	    	}
//		
//		}catch (Exception e) {
//			// TODO: handle exception
//			e.printStackTrace();
//		}
//	
//		
//	}
//	@SuppressWarnings({ "rawtypes", "static-access" })
//	@Transactional(noRollbackFor=RuntimeException.class,readOnly=false)
//	public void  addLeads(byte []bs,Map<String, String> map,Integer start,Employee employee) {
//		try{
//		InputStream inp = new ByteArrayInputStream(bs);
//		HSSFWorkbook workbook = new HSSFWorkbook(new POIFSFileSystem(inp));
//		Sheet  sheet = workbook.getSheetAt(0);
//		List<Row> rows = new ArrayList<Row>();
//		for (Row row : sheet) {
//			if(row.getRowNum()>=(start-1)){
//				rows.add(row);
//			}
//			
//		}
//		for (Integer i = 0;i<rows.size();i++) {
//			Lead lead = new Lead();
//			List<Cell> cells = new ArrayList<Cell>();
//			Integer checkNullsRowsFlag=new Integer(0);
//			
//			for (Cell cell : rows.get(i)) {
//				cells.add(cell);
//				
//			}
//			for(int j = 0; j<cells.size();j++){
//				CellReference cellReference = new CellReference(rows.get(i).getRowNum(), cells.get(j).getColumnIndex());
//				String columnName =  cellReference.convertNumToColString(j);
//				Set<String> set = map.keySet();
//				for (Iterator iterator = set.iterator(); iterator.hasNext();) {
//					String key = (String) iterator.next();
//					if(columnName.equalsIgnoreCase(map.get(key))){
////						if(key.equalsIgnoreCase("leadOwner")){
////							Employee employee = employeeService.getEmployeeByEmail(cells.get(j).getRichStringCellValue().toString());
////							if(employee != null){
////								lead.setLeadOwner(employee);
////							}
////						}
//						 if(key.equalsIgnoreCase("address")){
//							String cell = cells.get(j).toString();
//							if(cell != null && !cell.equalsIgnoreCase("")){
//								checkNullsRowsFlag++;
//								lead.setStreet(cells.get(j).getRichStringCellValue().toString());
//							}
//							
//						}
//						else if(key.equalsIgnoreCase("annualRevenue")){
//							String cell = cells.get(j).toString();
//							if(cell != null && !cell.equalsIgnoreCase("")){
//								checkNullsRowsFlag++;
//								double double1 = cells.get(j).getNumericCellValue();
//								Integer integer = (int)double1;
//								lead.setAnnualRevenue(integer);
//							}
//						}
//						else if(key.equalsIgnoreCase("area")){
//							String cell = cells.get(j).toString();
//							if(cell != null && !cell.equalsIgnoreCase("")){
//								checkNullsRowsFlag++;
//								if(cells.get(j).getRichStringCellValue().toString()!= null){
//									lead.setState(cells.get(j).getRichStringCellValue().toString());
//								}
//							}
//							
//						}else if(key.equalsIgnoreCase("city")){
//							String cell = cells.get(j).toString();
//							if(cell != null && !cell.equalsIgnoreCase("")){
//								checkNullsRowsFlag++;
//								City city = cityService.getCityByName(cells.get(j).getRichStringCellValue().toString());
//								lead.setCity(city);
//							}
//							
//						}else if(key.equalsIgnoreCase("companyName")){
//							String cell = cells.get(j).toString();
//							if(cell != null && !cell.equalsIgnoreCase("")){
//								checkNullsRowsFlag++;
//								lead.setCompanyName(cells.get(j).getRichStringCellValue().toString());
//							}
//							
//						}else if(key.equalsIgnoreCase("country")){
//							String cell = cells.get(j).toString();
//							if(cell != null && !cell.equalsIgnoreCase("")){
//								checkNullsRowsFlag++;
//								Country country =  countryService.getCountryByName(cells.get(j).getRichStringCellValue().toString());
//								if(country != null){
//								lead.setCountry(country);
//								}
//							}
//							
//						}else if(key.equalsIgnoreCase("creationDate")){
//							String cell = cells.get(j).toString();
//							if(cell != null && !cell.equalsIgnoreCase("")){
//								checkNullsRowsFlag++;
//								switch (cells.get(j).getCellType()) {
//								 case Cell.CELL_TYPE_NUMERIC:
//									 if (DateUtil.isCellDateFormatted(cells.get(j))) {
//										 lead.setDate(cells.get(j).getDateCellValue());
//				                    }
//									case Cell.CELL_TYPE_STRING:
//										if(importLeadUtils.checkDateInFormDayMonthYear(cells.get(j).toString())){
//											Date date = importLeadUtils.dateInFormDayMonthYear(cells.get(j).toString());
//											lead.setDate(date);
//										}
//								}
//							}
//							
//						}else if(key.equalsIgnoreCase("description")){
//							String cell = cells.get(j).toString();
//							if(cell != null && !cell.equalsIgnoreCase("")){
//								checkNullsRowsFlag++;
//								if(cells.get(j).getRichStringCellValue().toString() != null){
//									lead.setDescription(cells.get(j).getRichStringCellValue().toString());
//								}
//							}
//						}else if(key.equalsIgnoreCase("email")){
//							String cell = cells.get(j).toString();
//							if(cell != null && !cell.equalsIgnoreCase("")){
//								checkNullsRowsFlag++;
//							lead.setEmail(cells.get(j).getRichStringCellValue().toString());
//							}
//						}else if(key.equalsIgnoreCase("firstName")){
//							String cell = cells.get(j).toString();
//							if(cell != null && !cell.equalsIgnoreCase("")){
//								checkNullsRowsFlag++;
//								if(cells.get(j).getRichStringCellValue().getString() != null){
//									lead.setfName(cells.get(j).getRichStringCellValue().getString());
//									}
//							}
//						}else if(key.equalsIgnoreCase("Industry")){
//							String cell = cells.get(j).toString();
//							if(cell != null && !cell.equalsIgnoreCase("")){
//								checkNullsRowsFlag++;
////								Industry industry = industeryService.getIndustrybyName(cells.get(j).getRichStringCellValue().toString());
//								lead.setIndustry(cells.get(j).getRichStringCellValue().toString());
//							}
//						}else if(key.equalsIgnoreCase("lastName")){
//							String cell = cells.get(j).toString();
//							if(cell != null && !cell.equalsIgnoreCase("")){
//								checkNullsRowsFlag++;
//								if(cells.get(j).getRichStringCellValue().getString() != null){
//									lead.setlName(cells.get(j).getRichStringCellValue().getString());
//									}
//							}
//							
//						}else if(key.equalsIgnoreCase("leadSource")){
//							String cell = cells.get(j).toString();
//							if(cell != null && !cell.equalsIgnoreCase("")){
//								checkNullsRowsFlag++;
////								LeadSource leadSource = leadSourceService.getLeadSourceByName(cells.get(j).getRichStringCellValue().toString());
//								
//								lead.setLeadSource(cells.get(j).getRichStringCellValue().toString());
//							}
//							
//						}else if(key.equalsIgnoreCase("leadStatus")){
//							String cell = cells.get(j).toString();
//							if(cell != null && !cell.equalsIgnoreCase("")){
//								checkNullsRowsFlag++;
////								LeadStatus leadStatus = leadStatusService.getLeadStatusByName(cells.get(j).getRichStringCellValue().toString());
//								if(cells.get(j).getRichStringCellValue().toString() != null){
//									lead.setLeadStatus(cells.get(j).getRichStringCellValue().toString());
//								}
//							}
//							
//							
//						}else if(key.equalsIgnoreCase("numOfEmp")){
//							String cell = cells.get(j).toString();
//							if(cell != null && !cell.equalsIgnoreCase("")){
//								checkNullsRowsFlag++;
//								double double1 = cells.get(j).getNumericCellValue();
//								Integer integer = (int)double1;
//								lead.setNumOfEmp(integer);
//							}
//						}else if(key.equalsIgnoreCase("phone")){
//							String cell = cells.get(j).toString();
//							if(cell != null && !cell.equalsIgnoreCase("")){
//								checkNullsRowsFlag++;
//								lead.setPhone(cells.get(j).toString());
//							}
//							
//						}else if(key.equalsIgnoreCase("postalCode")){
//							String cell = cells.get(j).toString();
//							if(cell != null && !cell.equalsIgnoreCase("")){
//								checkNullsRowsFlag++;
//								if(cells.get(j).getNumericCellValue() != 0.0){
//									Integer integer = (int)cells.get(j).getNumericCellValue();
//									lead.setZipCode(integer.toString());
//								}
//							}
//							
//						}else if(key.equalsIgnoreCase("rating")){
//							String cell = cells.get(j).toString();
//							if(cell != null && !cell.equalsIgnoreCase("")){
//								checkNullsRowsFlag++;
////								Rating rating = ratingService.getRatingByname(cells.get(j).getRichStringCellValue().toString());
//								lead.setRating(cells.get(j).getRichStringCellValue().toString());
//							}
//							
//						}else if(key.equalsIgnoreCase("title")){
//							String cell = cells.get(j).toString();
//							if(cell != null && !cell.equalsIgnoreCase("")){
//								checkNullsRowsFlag++;
//								lead.setTitle(cells.get(j).getRichStringCellValue().toString());
//							}
//							
//						}else if(key.equalsIgnoreCase("webSite")){
//							String cell = cells.get(j).toString();
//							if(cell != null && !cell.equalsIgnoreCase("")){
//								checkNullsRowsFlag++;
//								lead.setWebSite(cells.get(j).getRichStringCellValue().toString());
//							}
//						}					
//					}
//				}
//			}
//			if(checkNullsRowsFlag >0){
//				lead.setLeadOwner(employee);
//				lead.setIsDeleted(false);
//				lead.setIsConverted(false);
//				leadService.addLead(lead);
//			}
//			
//		}
//		}catch(Exception e ){
//			e.printStackTrace();
//		}
//	}
//		
//		/////////////////////////////////////////////////////////////////////////////////////////////
//		@Transactional(noRollbackFor=RuntimeException.class,readOnly=false)
//		public void  addLeads(byte []bs,Integer start) {
//			try{
////			InputStream inp = new ByteArrayInputStream(bs);
////			HSSFWorkbook workbook = new HSSFWorkbook(new POIFSFileSystem(inp));
////			Sheet  sheet = workbook.getSheetAt(0);
////			List<Row> rows = new ArrayList<Row>();
////			for (Row row : sheet) {
////				rows.add(row);
////			}
////			for (Integer i = start-1;i<rows.size();i++) {
////				Lead lead = new Lead();
////				List<Cell> cells = new ArrayList<Cell>();
////				
////				for (Cell cell : rows.get(i)) {
////					cells.add(cell);
////					
////				}
////				for(int j = 0; j<cells.size();j++){
////					CellReference cellReference = new CellReference(rows.get(i).getRowNum(), cells.get(j).getColumnIndex());
////					String columnName =  cellReference.convertNumToColString(j);
////					if(columnName.equalsIgnoreCase(Character.toString(fName.toCharArray()[0]))){
////						if(cells.get(j).getRichStringCellValue().getString() != null){
////						lead.setfName(cells.get(j).getRichStringCellValue().getString());
////						}
////					}
////					else if(columnName.equalsIgnoreCase(Character.toString(lName.toCharArray()[0]))) {
////						if(cells.get(j).getRichStringCellValue().getString() != null){
////						lead.setlName(cells.get(j).getRichStringCellValue().getString());
////						}
////					}
////					else if(columnName.equalsIgnoreCase(Character.toString(leadOwner.toCharArray()[0]))) {
////						Employee employee = employeeService.getEmployeeByEmail(cells.get(j).getRichStringCellValue().toString());
////						if(employee != null){
////							lead.setLeadOwner(employee);
////						}
////					}
////					else if(columnName.equalsIgnoreCase(Character.toString(country.toCharArray()[0]))) {
////						Country country =  countryService.getCountryByName(cells.get(j).getRichStringCellValue().toString());
////						if(country != null){
////						lead.setCountry(country);
////						}
////					}
////					else if(columnName.equalsIgnoreCase(Character.toString(state.toCharArray()[0]))) {
////						if(cells.get(j).getRichStringCellValue().toString()!= null){
////							lead.setState(cells.get(j).getRichStringCellValue().toString());
////						}
////					}
////					else if(columnName.equalsIgnoreCase(Character.toString(zipCode.toCharArray()[0]))) {
////						if(cells.get(j).getNumericCellValue() != 0.0){
////							Integer integer = (int)cells.get(j).getNumericCellValue();
////							
////							lead.setZipCode(integer.toString());
////						}
////					}
////					else if(columnName.equalsIgnoreCase(Character.toString(address.toCharArray()[0]))) {
////						if(cells.get(j).getRichStringCellValue().toString() != null){
////							lead.setStreet(cells.get(j).getRichStringCellValue().toString());
////						}
////						
////					}
////					else if(columnName.equalsIgnoreCase(Character.toString(description.toCharArray()[0]))) {
////						if(cells.get(j).getRichStringCellValue().toString() != null){
////							lead.setDescription(cells.get(j).getRichStringCellValue().toString());
////						}
////					}
////					else if(columnName.equalsIgnoreCase(Character.toString(date.toCharArray()[0]))) {
////						switch (cells.get(j).getCellType()) {
////						 case Cell.CELL_TYPE_NUMERIC:
////							 if (DateUtil.isCellDateFormatted(cells.get(j))) {
////								 lead.setDate(cells.get(j).getDateCellValue());
////		                    }
////						}
////					}
////					else if(columnName.equalsIgnoreCase(Character.toString(city.toCharArray()[0]))) {
////						City city = cityService.getCityByName(cells.get(j).getRichStringCellValue().toString());
////						lead.setCity(city);
////					}
////					else if(columnName.equalsIgnoreCase(Character.toString(companyName.toCharArray()[0]))) {
////						lead.setCompanyName(cells.get(j).getRichStringCellValue().toString());
////					}
////					else if(columnName.equalsIgnoreCase(Character.toString(industry.toCharArray()[0]))) {
////						Industry industry = industeryService.getIndustrybyName(cells.get(j).getRichStringCellValue().toString());
////						lead.setIndustry(industry);
////					}
////					else if(columnName.equalsIgnoreCase(Character.toString(leadSource.toCharArray()[0]))) {
////						LeadSource leadSource = leadSourceService.getLeadSourceByName(cells.get(j).getRichStringCellValue().toString());
////						lead.setLeadSource(leadSource);
////					}
////					else if(columnName.equalsIgnoreCase(Character.toString(leadStatus.toCharArray()[0]))) {
////						LeadStatus leadStatus = leadStatusService.getLeadStatusByName(cells.get(j).getRichStringCellValue().toString());
////						if(leadStatus != null){
////							lead.setLeadStatus(leadStatus);
////						}
////					}
////					else if(columnName.equalsIgnoreCase(Character.toString(phone.toCharArray()[0]))) {
////						lead.setPhone(cells.get(j).getRichStringCellValue().toString());
////					}
////					else if(columnName.equalsIgnoreCase(Character.toString(title.toCharArray()[0]))) {
////						lead.setTitle(cells.get(j).getRichStringCellValue().toString());
////					}
////					else if(columnName.equalsIgnoreCase(Character.toString(rating.toCharArray()[0]))) {
////						Rating rating = ratingService.getRatingByname(cells.get(j).getRichStringCellValue().toString());
////						lead.setRating(rating);
////					}
////					else if(columnName.equalsIgnoreCase(Character.toString(email.toCharArray()[0]))) {
////						lead.setEmail(cells.get(j).getRichStringCellValue().toString());
////					}
////					else if(columnName.equalsIgnoreCase(Character.toString(webSite.toCharArray()[0]))) {
////						lead.setWebSite(cells.get(j).getRichStringCellValue().toString());
////					}
////					else if(columnName.equalsIgnoreCase(Character.toString(numOfEmp.toCharArray()[0]))) {
////						double double1 = cells.get(j).getNumericCellValue();
////						Integer integer = (int)double1;
////						lead.setNumOfEmp(integer);
////					}
////					else if(columnName.equalsIgnoreCase(Character.toString(annualRevenue.toCharArray()[0]))) {
////						double double1 = cells.get(j).getNumericCellValue();
////						Integer integer = (int)double1;
////						lead.setAnnualRevenue(integer);
////					}				
////					else {
////						//System.out.println("<<<<<<<<<<<<<<nothing>>>>>>>>>>>>>>>>>");
////					}
////					
////				}
////				lead.setIsDeleted(false);
////				lead.setIsConverted(false);
////				leadService.addLead(lead);
////			}
//			}catch(Exception e ){
//				e.printStackTrace();
//			}
//	}
////		@Transactional(noRollbackFor=RuntimeException.class,readOnly=false)
////		public void  addLeadsAsset(byte []bs,Integer start) {
////			try{
////				InputStream inp = new ByteArrayInputStream(bs);
////				HSSFWorkbook workbook = new HSSFWorkbook(new POIFSFileSystem(inp));
////				Sheet  sheet = workbook.getSheetAt(0);
////				List<Row> rows = new ArrayList<Row>();
////				for (Row row : sheet) {
////					if(row.getRowNum()>=(start-1)){
////						rows.add(row);
////					}
////				}
////					System.out.println(">>>>>>>>>>>>>>>rows size>>>><<<<<<<<<<<<<<"+rows.size());
////			  for (int i = 0;i<rows.size();i++) {
////				  Lead lead = new Lead();
////				  Call call = new Call();
////				  Account account = new Account();
////				  Appointment appointment = new Appointment();
////				  Contact contact  = new Contact();
////				  Contact  newContact = new Contact();
////					List<Cell> cells = new ArrayList<Cell>();
////					Integer checkNullsRowsFlag=new Integer(0);
////					System.out.println(">>>>>>>>>>>>>>>iiiiiiiiiiiiiiiiiiiiii>>>><<<<<<<<<<<<<<"+i);
////						for (Cell cell : rows.get(i)) {
////							cells.add(cell);
////							
////						}
////					
////					
////					for(int j = 0; j<cells.size();j++){
////						CellReference cellReference = new CellReference(rows.get(i).getRowNum(), cells.get(j).getColumnIndex());
////						@SuppressWarnings("static-access")
////						String columnName =  cellReference.convertNumToColString(j);
////						if(leadOwner.equalsIgnoreCase(columnName)){
////							Employee employee = employeeService.getEmployeeByEmail(cells.get(j).toString());
////							if(employee != null){
////								lead.setLeadOwner(employee);
////								checkNullsRowsFlag++;
////							}
////							continue;
////						}
////						else if(appointmentCompittorOffer.equalsIgnoreCase(columnName)){
////							if(cells.get(j).toString() != null && !cells.get(j).toString().equalsIgnoreCase("")){
////								appointment.setCompatitorOffer(importLeadUtils.checkCompititorOffer(cells.get(j).toString()));
////								checkNullsRowsFlag++;
////							}
////							continue;
////						}
////						else if(category.equalsIgnoreCase(columnName)){
////							if(cells.get(j).toString() != null && !cells.get(j).toString().equalsIgnoreCase("")){
////								lead.setCategory(cells.get(j).toString());
////								checkNullsRowsFlag++;
////							}
////							continue;
////						}
////						else if(callDate.equalsIgnoreCase(columnName)){
////							if(cells.get(j).toString() != null && !cells.get(j).toString().equalsIgnoreCase("")){
////								switch (cells.get(j).getCellType()) {
////								 case Cell.CELL_TYPE_NUMERIC:
////									 if (DateUtil.isCellDateFormatted(cells.get(j))) {
////										 call.setDate(cells.get(j).getDateCellValue());
////										 checkNullsRowsFlag++;
////				                    }
////									 break;
////									case Cell.CELL_TYPE_STRING:
////										if(importLeadUtils.checkDateInFormDayMonthYear(cells.get(j).toString())){
////											Date date = importLeadUtils.dateInFormDayMonthYear(cells.get(j).toString());
////											call.setDate(date);
////											checkNullsRowsFlag++;
////										}
////										else if(importLeadUtils.checkDateInFormDayMonthYearDashes(cells.get(j).toString())){
////											Date date = importLeadUtils.dateInFormDayMonthYearDashes(cells.get(j).toString());
////											call.setDate(date);
////											checkNullsRowsFlag++;
////										}
////										break;
////								}
////							}
////							continue;
////						}
////						else if(appointmentDiscountDone.equalsIgnoreCase(columnName)){
////
////							if(cells.get(j).toString() != null && !cells.get(j).toString().equalsIgnoreCase("")){
////								appointment.setDiscountDone(importLeadUtils.checkCompititorOffer(cells.get(j).toString()));
////								checkNullsRowsFlag++;
////							}
////							continue;
////						}
////						else if(appointmentOfferSubmitted.equalsIgnoreCase(columnName)){
////							if(cells.get(j).toString() != null && !cells.get(j).toString().equalsIgnoreCase("")){
////								appointment.setOfferSubmitted(importLeadUtils.checkCompititorOffer(cells.get(j).toString()));
////								checkNullsRowsFlag++;
////							}
////							continue;
////						}
////						else if(appointmentReplayPeriod.equalsIgnoreCase(columnName)){
////
////							if(cells.get(j).toString() != null && !cells.get(j).toString().equalsIgnoreCase("")){
////								appointment.setReplyPeriod(cells.get(j).toString());
////								checkNullsRowsFlag++;
////							}
////							continue;
////						}
////						else if(appointmentComments.equalsIgnoreCase(columnName)){
////
////							if(cells.get(j).toString() != null && !cells.get(j).toString().equalsIgnoreCase("")){
////								appointment.setComment(cells.get(j).toString());
////								checkNullsRowsFlag++;
////							}
////							continue;
////						}
////						else if(appointmentDealDone.equalsIgnoreCase(columnName)){
////
////							if(cells.get(j).toString() != null && !cells.get(j).toString().equalsIgnoreCase("")){
////								appointment.setDealClosingDone(importLeadUtils.checkCompititorOffer(cells.get(j).toString()));
////								checkNullsRowsFlag++;
////							}
////							continue;
////						}
////
////						else if(appointmentDealReason.equalsIgnoreCase(columnName)){
////							
////
////							if(cells.get(j).toString() != null && !cells.get(j).toString().equalsIgnoreCase("")){
////								appointment.setDealClosingReason(cells.get(j).toString());
////								checkNullsRowsFlag++;
////							}
////							continue;
////						}
////						else if(appointmentNextFollowUpCallDate.equalsIgnoreCase(columnName)){
////
////							if(cells.get(j).toString() != null && !cells.get(j).toString().equalsIgnoreCase("")){
////								//appointment.setNextFollowUp(true);
////								//appointment.setFollowUpDate(followUpDate);
////								if(importLeadUtils.checkDateInFormDayMonthYear(cells.get(j).toString())){
////									Date date = importLeadUtils.dateInFormDayMonthYear(cells.get(j).toString());
////									call.setDate(date);
////									checkNullsRowsFlag++;
////								}
////								else if(importLeadUtils.checkDateInFormDayMonthYearDashes(cells.get(j).toString())){
////									Date date = importLeadUtils.dateInFormDayMonthYearDashes(cells.get(j).toString());
////									call.setDate(date);
////									checkNullsRowsFlag++;
////								}
////								
////								checkNullsRowsFlag++;
////							}
////							continue;
////						}
////
////						else if(appointmentNextFollowUpCallDetails.equalsIgnoreCase(columnName)){
////
////							if(cells.get(j).toString() != null && !cells.get(j).toString().equalsIgnoreCase("")){
////								appointment.setFollowUpDetails(cells.get(j).toString());
////								checkNullsRowsFlag++;
////							}
////							continue;
////						}
////						else if(appointmentDemoDone.equalsIgnoreCase(columnName)){
////							if(cells.get(j).toString() != null && !cells.get(j).toString().equalsIgnoreCase("")){
////								appointment.setDemoDone(importLeadUtils.checkCompititorOffer(cells.get(j).toString()));
////								checkNullsRowsFlag++;
////							}
////							continue;
////						}
////						else if(appointmentMeetingDuration.equalsIgnoreCase(columnName)){
////
////							if(cells.get(j).toString() != null && !cells.get(j).toString().equalsIgnoreCase("")){
////								appointment.setMeetingDuration(cells.get(j).toString());
////								checkNullsRowsFlag++;
////							}
////							continue;
////						}
////						else if(appointmentMeetingDone.equalsIgnoreCase(columnName)){
////
////							if(cells.get(j).toString() != null && !cells.get(j).toString().equalsIgnoreCase("")){
////								appointment.setMeetingDone(importLeadUtils.checkCompititorOffer(cells.get(j).toString()));
////								checkNullsRowsFlag++;
////							}
////							continue;
////						}
////						else if(appointmentSalesMan.equalsIgnoreCase(columnName)){
////
////							if(cells.get(j).toString() != null && !cells.get(j).toString().equalsIgnoreCase("")){
////								Employee employee = employeeService.getEmployeeByEmail(cells.get(j).toString());
////								if(employee != null){
////									appointment.setSalesMan(employee);
////									checkNullsRowsFlag++;
////								}
////								
////							}
////							continue;
////						}
////						else if(appointmentComfirmationDateExpected.equalsIgnoreCase(columnName)){
////
////							if(cells.get(j).toString() != null && !cells.get(j).toString().equalsIgnoreCase("")){
////								appointment.setConfirmationDateExpected(cells.get(j).toString());
////								checkNullsRowsFlag++;
////							}
////							continue;
////						}
////						else if(appointmentTime.equalsIgnoreCase(columnName)){
////
////							if(cells.get(j).toString() != null && !cells.get(j).toString().equalsIgnoreCase("")){
////								appointment.setTime(cells.get(j).toString());
////								checkNullsRowsFlag++;
////							}
////							continue;
////						}
////						else if(appoimtmentDate.equalsIgnoreCase(columnName)){
////
////							if(cells.get(j).toString() != null && !cells.get(j).toString().equalsIgnoreCase("")){
////								if(importLeadUtils.checkDateInFormDayMonthYear(cells.get(j).toString())){
////									Date date = importLeadUtils.dateInFormDayMonthYear(cells.get(j).toString());
////									call.setDate(date);
////									checkNullsRowsFlag++;
////								}
////								else if(importLeadUtils.checkDateInFormDayMonthYearDashes(cells.get(j).toString())){
////									Date date = importLeadUtils.dateInFormDayMonthYearDashes(cells.get(j).toString());
////									call.setDate(date);
////									checkNullsRowsFlag++;
////								}
////							}
////							continue;
////						}
////						else if(appointmentDay.equalsIgnoreCase(columnName)){
////
////							if(cells.get(j).toString() != null && !cells.get(j).toString().equalsIgnoreCase("")){
////								appointment.setDay(cells.get(j).toString());
////								checkNullsRowsFlag++;
////							}
////							continue;
////						}
////						else if(contactNewtitle.equalsIgnoreCase(columnName)){
////
////							if(cells.get(j).toString() != null && !cells.get(j).toString().equalsIgnoreCase("")){
////								newContact.setTitle(cells.get(j).toString());
////								checkNullsRowsFlag++;
////							}
////							continue;
////						}
////						else if(contactNewName.equalsIgnoreCase(columnName)){
////
////							if(cells.get(j).toString() != null && !cells.get(j).toString().equalsIgnoreCase("")){
////								newContact.setfName(cells.get(j).toString());
////								checkNullsRowsFlag++;
////							}
////							continue;
////						}
////						
////						else if(contactPhone.equalsIgnoreCase(columnName)){
////
////							if(cells.get(j).toString() != null && !cells.get(j).toString().equalsIgnoreCase("")){
////								contact.setPhone(cells.get(j).toString());
////								checkNullsRowsFlag++;
////							}
////							continue;
////						}
////						else if(contactTitle.equalsIgnoreCase(columnName)){
////
////							if(cells.get(j).toString() != null && !cells.get(j).toString().equalsIgnoreCase("")){
////								contact.setTitle(cells.get(j).toString());
////								checkNullsRowsFlag++;
////								}
////							continue;
////						}
////						else if(contactName.equalsIgnoreCase(columnName)){
////
////							if(cells.get(j).toString() != null && !cells.get(j).toString().equalsIgnoreCase("")){
////								contact.setfName(cells.get(j).toString());
////								lead.setfName(cells.get(j).toString());
////								checkNullsRowsFlag++;
////							}
////							continue;
////						}
////						else if(callComments.equalsIgnoreCase(columnName)){
////
////							if(cells.get(j).toString() != null && !cells.get(j).toString().equalsIgnoreCase("")){
////								call.setComment(cells.get(j).toString());
////								checkNullsRowsFlag++;
////							}
////							continue;
////						}
////						else if(againAddToCarsNums.equalsIgnoreCase(columnName)){
////
////							if(cells.get(j).toString() != null && !cells.get(j).toString().equalsIgnoreCase("")){
////								lead.setCarsNum(cells.get(j).toString());
////							}
////							continue;
////						}
////						else if(addToCarsNums.equalsIgnoreCase(columnName)){
////
////							if(cells.get(j).toString() != null && !cells.get(j).toString().equalsIgnoreCase("")){
////							//	lead.setCarsNum(Integer.parseInt(cells.get(j).toString()));
////							}
////							continue;
////						}
////						else if(rating.equalsIgnoreCase(columnName)){
////
////							if(cells.get(j).toString() != null && !cells.get(j).toString().equalsIgnoreCase("")){
////								lead.setRating(cells.get(j).toString());
////							}
////							continue;
////						}
////						else if(description.equalsIgnoreCase(columnName)){
////
////							if(cells.get(j).toString() != null && !cells.get(j).toString().equalsIgnoreCase("")){
////								lead.setDescription(cells.get(j).toString());
////							}
////							continue;
////						}
////						else if(leadSource.equalsIgnoreCase(columnName)){
////
////							if(cells.get(j).toString() != null && !cells.get(j).toString().equalsIgnoreCase("")){
////								lead.setLeadSource(cells.get(j).toString());
////							}
////							continue;
////						}
////						else if(carsNum.equalsIgnoreCase(columnName)){
////
////							if(cells.get(j).toString() != null && !cells.get(j).toString().equalsIgnoreCase("")){
////								if(lead.getCarsNum() == null){
////									lead.setCarsNum(cells.get(j).toString());
////								}
////							}
////							continue;
////						}
////						else if(email.equalsIgnoreCase(columnName)){
////
////							if(cells.get(j).toString() != null && !cells.get(j).toString().equalsIgnoreCase("")){
////								lead.setEmail(cells.get(j).toString());
////								checkNullsRowsFlag++;
////							}
////							continue;
////						}
////						else if(street.equalsIgnoreCase(columnName)){
////
////							if(cells.get(j).toString() != null && !cells.get(j).toString().equalsIgnoreCase("")){
////								lead.setStreet(cells.get(j).toString());
////								checkNullsRowsFlag++;
////							}
////							continue;
////						}
////						else if(phone.equalsIgnoreCase(columnName)){
////
////							if(cells.get(j).toString() != null && !cells.get(j).toString().equalsIgnoreCase("")){
////								lead.setPhone(cells.get(j).toString());
////								checkNullsRowsFlag++;
////							}
////							continue;
////						}
////						else if(companyName.equalsIgnoreCase(columnName)){
////
////							if(cells.get(j).toString() != null && !cells.get(j).toString().equalsIgnoreCase("")){
////								lead.setCompanyName(cells.get(j).toString());
////								checkNullsRowsFlag++;
////							}
////							continue;
////						}
////						else if(leadStatus.equalsIgnoreCase(columnName)){
////
////							if(cells.get(j).toString() != null && !cells.get(j).toString().equalsIgnoreCase("")){
////								lead.setLeadStatus(cells.get(j).toString());
////								checkNullsRowsFlag++;
////							}
////							continue;
////						}
////			System.out.println("========================================================="+columnName);
////					}
////					if(checkNullsRowsFlag >0){
////						lead.setIsDeleted(false);
////						lead.setIsConverted(false);
////						leadService.addLead(lead);
////						contact.setParentId(lead.getId());
//////						ViewType viewType = viewTypeService.getViewTypeById(1);
////						contact.setViewType(VIEWTYPE.Lead.getName());
////						contactService.addContact(contact);
////						newContact.setParentId(lead.getId());
////						newContact.setViewType(VIEWTYPE.Lead.getName());
////						contactService.addContact(newContact);
////						call.setParentId(lead.getId());
////						call.setParentType("lead");
////						callService.addCall(call);
////						appointment.setParentId(lead.getId());
////						appointment.setParentType("lead");
////						appointmentService.addAppointment(appointment);
////					}
////		    	}
////			
////			}catch (Exception e) {
////				// TODO: handle exception
////				e.printStackTrace();
////			}
////		}
////	
////		@Transactional(noRollbackFor=RuntimeException.class,readOnly=false)
////		public void  addLeadsAsset(byte []bs,Integer start,Employee userDetails) {
////
////			try{
////				InputStream inp = new ByteArrayInputStream(bs);
////				HSSFWorkbook workbook = new HSSFWorkbook(new POIFSFileSystem(inp));
////				Sheet  sheet = workbook.getSheetAt(0);
//////				List<Row> rows = new ArrayList<Row>();
////				for (Row row : sheet) {
////					if(row.getRowNum()>=(start-1)){
//////						rows.add(row);
////						  Lead lead = new Lead();
////						  Call call = new Call();
////						  Account account = new Account();
////						  Appointment appointment = new Appointment();
////						  Contact contact  = new Contact();
////						  Contact  newContact = new Contact();
//////							List<Cell> cells = new ArrayList<Cell>();
////							Integer checkNullsRowsFlag=new Integer(0);
//////							System.out.println(">>>>>>>>>>>>>>>iiiiiiiiiiiiiiiiiiiiii>>>><<<<<<<<<<<<<<");
////								for (Cell cell : row) {
//////									cells.add(cell);
////
////									CellReference cellReference = new CellReference(row.getRowNum(), cell.getColumnIndex());
////									@SuppressWarnings("static-access")
////									String columnName =  cellReference.convertNumToColString(cell.getColumnIndex());
////									if(leadOwner.equalsIgnoreCase(columnName)){
//////										Employee employee = employeesService.getEmployeeByEmail(cell.toString());
//////										if(employee != null){
////											lead.setLeadOwner(userDetails);
//////											checkNullsRowsFlag++;
//////										}
////										continue;
////									}
////									else if(appointmentCompittorOffer.equalsIgnoreCase(columnName)){
////										if(cell.toString() != null && !cell.toString().equalsIgnoreCase("")){
////											appointment.setCompatitorOffer(importLeadUtils.checkCompititorOffer(cell.toString()));
////											checkNullsRowsFlag++;
////										}
////										continue;
////									}
////									else if(category.equalsIgnoreCase(columnName)){
////										if(cell.toString() != null && !cell.toString().equalsIgnoreCase("")){
////											lead.setCategory(cell.toString());
////											checkNullsRowsFlag++;
////										}
////										continue;
////									}
////									else if(callDate.equalsIgnoreCase(columnName)){
////										if(cell.toString() != null && !cell.toString().equalsIgnoreCase("")){
////											switch (cell.getCellType()) {
////											 case Cell.CELL_TYPE_NUMERIC:
////												 if (DateUtil.isCellDateFormatted(cell)) {
////													 lead.setDate(cell.getDateCellValue());
////													 call.setDate(cell.getDateCellValue());
////													 checkNullsRowsFlag++;
////							                    }
////												 break;
////												case Cell.CELL_TYPE_STRING:
////													if(importLeadUtils.checkDateInFormDayMonthYear(cell.toString())){
////														Date date = importLeadUtils.dateInFormDayMonthYear(cell.toString());
////														call.setDate(date);
////														lead.setDate(date);
////														checkNullsRowsFlag++;
////													}
////													else if(importLeadUtils.checkDateInFormDayMonthYearDashes(cell.toString())){
////														Date date = importLeadUtils.dateInFormDayMonthYearDashes(cell.toString());
////														call.setDate(date);
////														lead.setDate(date);
////														checkNullsRowsFlag++;
////													}
////													else if(importLeadUtils.checkDateInFormMonthDayYearDashes(cell.toString())){
////														Date date = importLeadUtils.dateInFormMonthDayYearDashes(cell.toString());
////														call.setDate(date);
////														lead.setDate(date);
////														checkNullsRowsFlag++;
////													}
////													else if(importLeadUtils.checkDateInFormMonthDayYear(cell.toString())){
////														Date date = importLeadUtils.dateInFormMonthDayYear(cell.toString());
////														call.setDate(date);
////														lead.setDate(date);
////														checkNullsRowsFlag++;
////													}
////													break;
////											}
////										}
////										continue;
////									}
////									else if(appointmentDiscountDone.equalsIgnoreCase(columnName)){
////
////										if(cell.toString() != null && !cell.toString().equalsIgnoreCase("")){
////											appointment.setDiscountDone(importLeadUtils.checkCompititorOffer(cell.toString()));
////											checkNullsRowsFlag++;
////										}else if(cell.toString() != null){
////											appointment.setDiscountDone(importLeadUtils.checkCompititorOffer(cell.toString()));
////										}
////										continue;
////									}
////									else if(appointmentOfferSubmitted.equalsIgnoreCase(columnName)){
////										if(cell.toString() != null && !cell.toString().equalsIgnoreCase("")){
////											appointment.setOfferSubmitted(importLeadUtils.checkCompititorOffer(cell.toString()));
////											checkNullsRowsFlag++;
////										}
////										continue;
////									}
////									else if(appointmentReplayPeriod.equalsIgnoreCase(columnName)){
////
////										if(cell.toString() != null && !cell.toString().equalsIgnoreCase("")){
////											appointment.setReplyPeriod(cell.toString());
////											checkNullsRowsFlag++;
////										}
////										continue;
////									}
////									else if(appointmentComments.equalsIgnoreCase(columnName)){
////
////										if(cell.toString() != null && !cell.toString().equalsIgnoreCase("")){
////											appointment.setComment(cell.toString());
////											checkNullsRowsFlag++;
////										}
////										continue;
////									}
////									else if(appointmentDealDone.equalsIgnoreCase(columnName)){
////
////										if(cell.toString() != null && !cell.toString().equalsIgnoreCase("")){
////											appointment.setDealClosingDone(importLeadUtils.checkCompititorOffer(cell.toString()));
////											checkNullsRowsFlag++;
////										}else if(cell.toString() != null){
////											appointment.setDealClosingDone(importLeadUtils.checkCompititorOffer(cell.toString()));
////										}
////										continue;
////									}
////
////									else if(appointmentDealReason.equalsIgnoreCase(columnName)){
////										
////
////										if(cell.toString() != null && !cell.toString().equalsIgnoreCase("")){
////											appointment.setDealClosingReason(cell.toString());
////											checkNullsRowsFlag++;
////										}
////										continue;
////									}
////									else if(appointmentNextFollowUpCallDate.equalsIgnoreCase(columnName)){
////
////										if(cell.toString() != null && !cell.toString().equalsIgnoreCase("")){
////											//appointment.setNextFollowUp(true);
////											//appointment.setFollowUpDate(followUpDate);
////											if(importLeadUtils.checkDateInFormDayMonthYear(cell.toString())){
////												Date date = importLeadUtils.dateInFormDayMonthYear(cell.toString());
////												call.setDate(date);
////												checkNullsRowsFlag++;
////											}
////											else if(importLeadUtils.checkDateInFormDayMonthYearDashes(cell.toString())){
////												Date date = importLeadUtils.dateInFormDayMonthYearDashes(cell.toString());
////												call.setDate(date);
////												checkNullsRowsFlag++;
////											}
////											
////											checkNullsRowsFlag++;
////										}
////										continue;
////									}
////
////									else if(appointmentNextFollowUpCallDetails.equalsIgnoreCase(columnName)){
////
////										if(cell.toString() != null && !cell.toString().equalsIgnoreCase("")){
////											appointment.setFollowUpDetails(cell.toString());
////											checkNullsRowsFlag++;
////										}
////										continue;
////									}
////									else if(appointmentDemoDone.equalsIgnoreCase(columnName)){
////										if(cell.toString() != null && !cell.toString().equalsIgnoreCase("")){
////											appointment.setDemoDone(importLeadUtils.checkCompititorOffer(cell.toString()));
////											checkNullsRowsFlag++;
////										}else if(cell.toString() != null){
////											appointment.setDemoDone(importLeadUtils.checkCompititorOffer(cell.toString()));
////										}
////										continue;
////									}
////									else if(appointmentMeetingDuration.equalsIgnoreCase(columnName)){
////
////										if(cell.toString() != null && !cell.toString().equalsIgnoreCase("")){
////											appointment.setMeetingDuration(cell.toString());
////											checkNullsRowsFlag++;
////										}else if(cell.toString() != null){
////											appointment.setMeetingDuration(cell.toString());
////										}
////										continue;
////									}
////									else if(appointmentMeetingDone.equalsIgnoreCase(columnName)){
////
////										if(cell.toString() != null && !cell.toString().equalsIgnoreCase("")){
////											appointment.setMeetingDone(importLeadUtils.checkCompititorOffer(cell.toString()));
////											checkNullsRowsFlag++;
////										}
////										continue;
////									}
////									else if(appointmentSalesMan.equalsIgnoreCase(columnName)){
////
////										if(cell.toString() != null && !cell.toString().equalsIgnoreCase("")){
////											Employee employee = employeeService.getEmployeeByEmail(cell.toString());
////											if(employee != null){
////												appointment.setSalesMan(employee);
////												checkNullsRowsFlag++;
////											}
////											
////										}
////										continue;
////									}
////									else if(appointmentComfirmationDateExpected.equalsIgnoreCase(columnName)){
////
////										if(cell.toString() != null && !cell.toString().equalsIgnoreCase("")){
////											appointment.setConfirmationDateExpected(cell.toString());
////											checkNullsRowsFlag++;
////										}
////										continue;
////									}
////									else if(appointmentTime.equalsIgnoreCase(columnName)){
////
////										if(cell.toString() != null && !cell.toString().equalsIgnoreCase("")){
////											appointment.setTime(cell.toString());
////											checkNullsRowsFlag++;
////										}
////										continue;
////									}
////									
////									else if(appoimtmentDate.equalsIgnoreCase(columnName)){
////										
////										if(cell.toString() != null && !cell.toString().equalsIgnoreCase("")){
////											System.out.println(appoimtmentDate+" @@@@@@@@@@@@@@@@@@@@@@@Big iffffffff"+cell.toString());
////											if(importLeadUtils.checkDateInFormDayMonthYear(cell.toString())){
////												Date date = importLeadUtils.dateInFormDayMonthYear(cell.toString());
////												System.out.println(appoimtmentDate+" @@@@@@@@@@@@@@@@@@@@@@@ iffffffff"+cell.toString());
////												appointment.setDate(date);
////												checkNullsRowsFlag++;
////											}
////											else if(importLeadUtils.checkDateInFormDayMonthYearDashes(cell.toString())){
////												System.out.println(appoimtmentDate+" @@@@@@@@@@@@@@@@@@@@@@@ else if"+cell.toString());
////												Date date = importLeadUtils.dateInFormDayMonthYearDashes(cell.toString());
////												appointment.setDate(date);
////												checkNullsRowsFlag++;
////											}
////											else if(cell.getCellType()== Cell.CELL_TYPE_NUMERIC){
////												System.out.println(appoimtmentDate+" @@@@@@@@@@@@@@@@@@@@@@@ else if22"+cell.toString());
////												if(DateUtil.isCellDateFormatted(cell)){
////													System.out.println(appoimtmentDate+" @@@@@@@@@@@@@@@@@@@@@@@ else if22if"+cell.toString());
////													appointment.setDate(cell.getDateCellValue());
////												}
////											}
////										}
////										continue;
////									}
////									else if(appointmentDay.equalsIgnoreCase(columnName)){
////
////										if(cell.toString() != null && !cell.toString().equalsIgnoreCase("")){
////											appointment.setDay(cell.toString());
////											checkNullsRowsFlag++;
////										}
////										continue;
////									}
////									else if(contactNewtitle.equalsIgnoreCase(columnName)){
////
////										if(cell.toString() != null && !cell.toString().equalsIgnoreCase("")){
////											newContact.setTitle(cell.toString());
////											checkNullsRowsFlag++;
////										}
////										continue;
////									}
////									else if(contactNewName.equalsIgnoreCase(columnName)){
////
////										if(cell.toString() != null && !cell.toString().equalsIgnoreCase("")){
////											newContact.setfName(cell.toString());
////											checkNullsRowsFlag++;
////										}
////										continue;
////									}
////									
////									else if(contactPhone.equalsIgnoreCase(columnName)){
////
////										if(cell.toString() != null && !cell.toString().equalsIgnoreCase("")){
////											switch (cell.getCellType()) {
////											case Cell.CELL_TYPE_NUMERIC:
////												System.out.println("l;sjabfgakvbsfsaiggfyvhmsafhkahsvf"+cell.getNumericCellValue());
////												contact.setPhone("0100505405965");
////												break;
////
////											default:
////												contact.setPhone(cell.toString());
////												break;
////											}
////											
////											checkNullsRowsFlag++;
////										}
////										continue;
////									}
////									else if(contactTitle.equalsIgnoreCase(columnName)){
////
////										if(cell.toString() != null && !cell.toString().equalsIgnoreCase("")){
////											contact.setTitle(cell.toString());
////											checkNullsRowsFlag++;
////											}
////										continue;
////									}
////									
////									else if(decisionMaker.equalsIgnoreCase(columnName)){
////
////										if(cell.toString() != null && !cell.toString().equalsIgnoreCase("")){
////											
////											call.setDecisionMaker(importLeadUtils.checkCompititorOffer(cell.toString()));
////											checkNullsRowsFlag++;
////										}else if(cell.toString() != null ){
////											call.setDecisionMaker(importLeadUtils.checkCompititorOffer(cell.toString()));
////										}
////										continue;
////									}
////									else if(contactName.equalsIgnoreCase(columnName)){
////
////										if(cell.toString() != null && !cell.toString().equalsIgnoreCase("")){
////											String[] str = importLeadUtils.splitNameFromSheet(cell.toString());
////											contact.setfName(str[0]);
////											contact.setlName(str[1]);
////											lead.setfName(str[0]);
////											lead.setlName(str[1]);
////											checkNullsRowsFlag++;
////										}
////										continue;
////									}
////									else if(callComments.equalsIgnoreCase(columnName)){
////
////										if(cell.toString() != null && !cell.toString().equalsIgnoreCase("")){
////											call.setComment(cell.toString());
////											lead.setDescription(cell.toString());
////											checkNullsRowsFlag++;
////										}
////										continue;
////									}
////									else if(againAddToCarsNums.equalsIgnoreCase(columnName)){
////
////										if(cell.toString() != null && !cell.toString().equalsIgnoreCase("")){
////											lead.setCarsNum(cell.toString());
////										}
////										continue;
////									}
////									else if(addToCarsNums.equalsIgnoreCase(columnName)){
////
////										if(cell.toString() != null && !cell.toString().equalsIgnoreCase("")){
////										//	lead.setCarsNum(Integer.parseInt(cells.get(j).toString()));
////										}
////										continue;
////									}
////									else if(rating.equalsIgnoreCase(columnName)){
////
////										if(cell.toString() != null && !cell.toString().equalsIgnoreCase("")){
////											lead.setRating(cell.toString());
////										}
////										continue;
////									}
////									else if(description.equalsIgnoreCase(columnName)){
////
////										if(cell.toString() != null && !cell.toString().equalsIgnoreCase("")){
////											lead.setDescription(cell.toString());
////										}
////										continue;
////									}
////									else if(leadSource.equalsIgnoreCase(columnName)){
////
////										if(cell.toString() != null && !cell.toString().equalsIgnoreCase("")){
////											lead.setLeadSource(cell.toString());
////										}
////										continue;
////									}
////									else if(carsNum.equalsIgnoreCase(columnName)){
////
////										if(cell.toString() != null && !cell.toString().equalsIgnoreCase("")){
////											if(lead.getCarsNum() == null){
////												lead.setCarsNum(cell.toString());
////											}
////										}
////										continue;
////									}
////									else if(email.equalsIgnoreCase(columnName)){
////
////										if(cell.toString() != null && !cell.toString().equalsIgnoreCase("")){
////											lead.setEmail(cell.toString());
////											checkNullsRowsFlag++;
////										}
////										continue;
////									}
////									else if(street.equalsIgnoreCase(columnName)){
////
////										if(cell.toString() != null && !cell.toString().equalsIgnoreCase("")){
////											lead.setStreet(cell.toString());
////											checkNullsRowsFlag++;
////										}
////										continue;
////									}
////									else if(phone.equalsIgnoreCase(columnName)){
////
////										if(cell.toString() != null && !cell.toString().equalsIgnoreCase("")){
////											lead.setPhone(cell.toString());
////											checkNullsRowsFlag++;
////										}
////										continue;
////									}
////									else if(companyName.equalsIgnoreCase(columnName)){
////
////										if(cell.toString() != null && !cell.toString().equalsIgnoreCase("")){
////											lead.setCompanyName(cell.toString());
////											checkNullsRowsFlag++;
////										}
////										continue;
////									}
////									else if(leadStatus.equalsIgnoreCase(columnName)){
////
////										if(cell.toString() != null && !cell.toString().equalsIgnoreCase("")){
////											lead.setLeadStatus(cell.toString());
////											checkNullsRowsFlag++;
////										}
////										continue;
////									}
//////						System.out.println("========================================================="+columnName);
////								
////									
////								}
////							
////							
////							//for(int j = 0; j<cells.size();j++){}
////							if(checkNullsRowsFlag >0){
////								lead.setIsDeleted(false);
////								lead.setIsConverted(false);
////								Date date = new Date();
////								lead.setDateCreated(date);
////								lead.setDateModified(date);
////								leadService.addLead(lead);
////								contact.setParentId(lead.getId());
//////								ViewType viewType = viewTypeService.getViewTypeById(1);
////								contact.setViewType(VIEWTYPE.Lead.getName());
////								contact.setIsDeleted(false);
////								contact.setCreator(userDetails);
////								contact.setDateCreated(date);
////								contact.setDateModified(date);
////								contact.setParentName(lead.getfName());
////								contactService.addContact(contact);
////								newContact.setParentId(lead.getId());
////								newContact.setViewType(VIEWTYPE.Lead.getName());
////								newContact.setIsDeleted(false);
////								newContact.setCreator(userDetails);
////								newContact.setDateCreated(new Date());
////								newContact.setDateModified(date);
////								contact.setParentName(lead.getfName());
////								contactService.addContact(newContact);
////								call.setParentId(lead.getId());
////								call.setParentType("lead");
////								call.setCrmStaff(userDetails);
////								call.setContactedPerson(contact);
////								call.setDateCreated(date);
////								call.setDateModified(date);
////								java.util.Calendar calInst = java.util.Calendar.getInstance();
////								calInst.setTime(date);
//////								System.out.println(">>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<"+calInst.getTime().getHours());
////								call.setStartTime(new Integer(calInst.getTime().getHours()).toString()+":"+new Integer(calInst.getTime().getMinutes()+row.getRowNum()).toString());
////								call.setEndTime(new Integer(calInst.getTime().getHours()).toString()+":"+new Integer(calInst.getTime().getMinutes()+row.getRowNum()+10).toString());
////								call.setInOutCall(false);
////								call.setNextFollowUp(true);
////								call.setDecisionMaker(true);
////								callService.addCall(call);
////								appointment.setParentId(lead.getId());
////								appointment.setParentType("lead");
////								appointment.setSalesMan(userDetails);
////								appointment.setContactedPerson(newContact);
////								appointment.setNextFollowUp(true);
////								appointment.setCompatitorOffer(true);
////								appointment.setOfferSubmitted(true);
////								appointment.setMeetingDone(true);
////								appointment.setDiscountDone(true);
////								appointment.setDemoDone(true);
////								appointment.setDealClosingDone(true);
////								appointment.setDealClosingDone(true);
////								appointment.setDateCreated(date);
////								appointment.setDateModified(date);
////								appointmentService.addAppointment(appointment);
////							}
////					}
////				}
//////					System.out.println(">>>>>>>>>>>>>>>rows size>>>><<<<<<<<<<<<<<");
//////			  for (int i = 0;i<rows.size();i++) {
//////
//////		    	}
////			
////			}catch (Exception e) {
////				// TODO: handle exception
////				e.printStackTrace();
////			}
////		
////		}
//		
//}
